﻿using System.Collections.Generic;
using System;
using MathNet.Spatial.Euclidean;

namespace FDEE.Model
{
    public class BPE32 : RampBPTMBase
    {
        /// <summary>
        /// PTM1盖梁设置
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="pierNumber"></param>
        /// <param name="height"></param>
        /// <param name="width"></param>
        /// <param name="lwidth"></param>
        /// <param name="calculatedHeight"></param>
        /// <param name="L1"></param>
        /// <param name="L2"></param>
        /// <param name="span"></param>
        public BPE32(string typeName, string pierNumber,
            int height, int width, double lwidth, int length,
            int span) :
            base(typeName, pierNumber, height, width,lwidth, length,span)
        {
        }
        /// <summary>
        /// 配筋算量计算
        /// </summary>
        public override void SetRebarList()
        {
            RebarList = new RebarCollection();
           
            #region 全局变量
            int N11 = 14;
            int N12 = 10;
            int N13 = 10;
            int N21 = 8;
            int N22 = 2;
            int N3 = 2*2;
            int N41 = 3;
            int N42 = 1;
            int N5 = 6*2;
            #endregion

          
    
            int bb1 =(int)Width - 50 * 2;
            int cc1 = Height - 50*2-100-16;
            int aa1 = cc1;
            int r = RebarKnowledge.GerRadius(eDB.DB28);
            int d = PublicEnumItems.GeteDBData(eDB.DB28.ToString());
            double Len1 = (aa1 + bb1 + cc1 - r - 2 * d)*0.001;
            double Lap = GlobalFuncs.GetLapLength(eConcreteClass.C45, eDB.DB32);
            if (Len1 <= 12)
            {
                #region 1号钢筋
                RebarList.Add(new MCRebarRecord(1, 1, "", eDB.DB32, aa1, bb1, cc1, N11, eShapeType.MCB));
                bb1 = (int)Width - 50 * 2 - 28 * 2;
                cc1 = Height - 50 * 2 - 100 - 16 - 28;
                aa1 = cc1;
                RebarList.Add(new MCRebarRecord(1, 2, "", eDB.DB32, aa1, bb1, cc1, N12, eShapeType.MCB));
                bb1 = (int)Width - 50 * 2 - 28 * 2;
                cc1 = Height - 50 * 2 - 100 - 16 - 28 * 2;
                aa1 = cc1;
                RebarList.Add(new MCRebarRecord(1, 3, "", eDB.DB32, aa1, bb1, cc1, N13, eShapeType.MCB));
                //UboltList.UBoltNum[eDB.DB25] += 4 * N11 * 2;
                #endregion


                #region 2号钢筋
                int bb2 = (int)Width - 50 * 2;
                int cc2 = Height - 50 * 2 - 16 * 2;
                int aa2 = cc2;
                RebarList.Add(new MCRebarRecord(2, 1, "", eDB.DB20, aa2, bb2, cc2, N21, eShapeType.MCT));
                bb2 = (int)Width - 50 * 2;
                cc2 = Height - 50 - 150 - 16;
                aa2 = cc2;
                RebarList.Add(new MCRebarRecord(2, 2, "", eDB.DB20, aa2, bb2, cc2, N22, eShapeType.MCT));
                #endregion

                #region 3号钢筋
                int bb3 = (int)Width - 50 * 2 - 28 * 2 * 2;
                int cc3 = 500;
                int aa3 = cc3;
                RebarList.Add(new MCRebarRecord(3, 0, "", eDB.DB20, aa3, bb3, cc3, N3, eShapeType.MCT));
                #endregion

                #region 4#
                int N4A = Height - 50 * 2 - 16 * 2;
                int N4B = 115 * 3 + 28;
                int scale = (int)((Width - 50 * 2) / 250);
                RebarList.Add(new MORebarRecord(4, 1, "", eDB.DB16, N41 * scale, eShapeType.MO, N4A, N4B));
                //RebarList.Add(new MORebarRecord(4, 2, "", eDB.DB16, N42, eShapeType.MO, N4A, N4B));
                N4A = Height - 50 * 2 - 16 * 2;
                N4B = (int)Length - 50 * 2 - 2 * 16;
                RebarList.Add(new MORebarRecord(4, 2, "", eDB.DB16, N42 * scale, eShapeType.MO, N4A, N4B));
                #endregion

                #region 5# 
                int bb5 = (int)Length - 50 * 2 - 2 * 16;
                int cc5 = 600;
                int aa5 = cc5;
                RebarList.Add(new MCRebarRecord(5, 0, "", eDB.DB20, aa5, bb5, cc5, N5, eShapeType.MCR));
                #endregion
            }
            else
            {
                aa1 = 9000;                 
                #region 1号钢筋
                RebarList.Add(new MLCRebarRecord(1, 1, "", eDB.DB32, aa1, cc1,  N11, eShapeType.MLL));
                bb1= (int)Width - 50 * 2-aa1 + (int)Lap;
                RebarList.Add(new MLCRebarRecord(1, 1, "a", eDB.DB32, bb1, cc1, N11, eShapeType.MLR));
                double LEN1 = (int)Width - 50 * 2 - 2250 * 2;
                int N1 = 20;
                RebarList.Add(new MARebarRecord(1, 2, "", eDB.DB32, (int)LEN1, N1, eShapeType.MA));
                //bb1 = (int)Width - 50 * 2 - 28 * 2 - aa1 + 980*2;
                //cc1 = Height - 50 * 2 - 100 - 16 - 28;
                ////aa1 = cc1;
                //RebarList.Add(new MLRebarRecord(1, 2, "", eDB.DB28, aa1,  cc1, N12, eShapeType.MLL));
                //RebarList.Add(new MLRebarRecord(1, 2, "a", eDB.DB28, bb1, cc1, N12, eShapeType.MLR));
                //bb1 = (int)Width - 50 * 2 - 28 * 2 - aa1 + 980 * 2;
                //cc1 = Height - 50 * 2 - 100 - 16 - 28 * 2;
                ////aa1 = cc1;
                //RebarList.Add(new MLRebarRecord(1, 3, "", eDB.DB28, aa1,  cc1, N13, eShapeType.MLL));
                //RebarList.Add(new MLRebarRecord(1, 3, "", eDB.DB28, bb1, cc1, N13, eShapeType.MLR));
                UboltList.UBoltNum[eDB.DB28] +=  N11 * 2;
                #endregion


                #region 2号钢筋
                Lap = GlobalFuncs.GetLapLength(eConcreteClass.C45, eDB.DB20);
                int aa2 = 9000;
                int bb2 = (int)Width - 50 * 2-aa2+ (int)Lap;
                int cc2 = Height - 50 * 2 - 16 * 2;
               
                RebarList.Add(new MLCRebarRecord(2, 1, "", eDB.DB20, aa2,  cc2, N21, eShapeType.MLL));
                RebarList.Add(new MLCRebarRecord(2, 1, "a", eDB.DB20,  bb2, cc2, N21, eShapeType.MLR));

                bb2 = (int)Width - 50 * 2-aa2 + (int)Lap; 
                cc2 = Height - 50 - 150 - 16;
                //aa2 = cc2;
                RebarList.Add(new MLCRebarRecord(2, 2, "", eDB.DB20, aa2,  cc2, N22, eShapeType.MLL));
                RebarList.Add(new MLCRebarRecord(2, 2, "a", eDB.DB20,  bb2, cc2, N22, eShapeType.MLR));
                UboltList.UBoltNum[eDB.DB20] += ( N11+ N22) * 2;
                #endregion

                #region 3号钢筋
                int aa3 = 9000;
                int bb3 = (int)Width - 50 * 2 - 28 * 2 * 2 - aa3 + (int)Lap; 
                int cc3 = 500;
              
                RebarList.Add(new MLCRebarRecord(3, 0, "", eDB.DB20, aa3,  cc3, N3, eShapeType.MLL));
                RebarList.Add(new MLCRebarRecord(3, 0, "a", eDB.DB20,  bb3, cc3, N3, eShapeType.MLR));
                UboltList.UBoltNum[eDB.DB28] += N11 * 2;
                #endregion

                #region 4#
                int N4A = Height - 50 * 2 - 16 * 2;
                int N4B = 115 * 3 + 28;
                int scale = (int)((Width - 50 * 2) / 250);
                RebarList.Add(new MORebarRecord(4, 1, "", eDB.DB16, N41 * scale, eShapeType.MO, N4A, N4B));
                //RebarList.Add(new MORebarRecord(4, 2, "", eDB.DB16, N42, eShapeType.MO, N4A, N4B));
                N4A = Height - 50 * 2 - 16 * 2;
                N4B = (int)Length - 50 * 2 - 2 * 16;
                RebarList.Add(new MORebarRecord(4, 2, "", eDB.DB16, N42 * scale, eShapeType.MO, N4A, N4B));
                #endregion

                #region 5# 
                int bb5 = (int)Length - 50 * 2 - 2 * 16;
                int cc5 = 600;
                int aa5 = cc5;
                RebarList.Add(new MCRebarRecord(5, 0, "", eDB.DB20, aa5, bb5, cc5, N5, eShapeType.MCR));
                #endregion
            }
        }
        /// <summary>
        /// 预应力计算
        /// </summary>
        public override void SetTendonList()
        {
            TendonDistribute = new RebarTendonDistribute(320, new List<double>() {  });        
        }
    }
}
